package com.hmall.mapper;

import com.hmall.model.MallPrice;
import com.hmall.util.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

@Repository
public interface MallPriceMapper extends MyMapper<MallPrice> {
    BigDecimal selectPriceNum(@Param(value = "productId") Integer productId, @Param(value = "weight") BigDecimal weight, @Param("grade") String grade);
    //取那样单价
    BigDecimal selectPriceNumSample(@Param(value = "productId") Integer productId, @Param("grade") String grade);
    List<MallPrice> findPriceList(@Param("productId") Integer productId);


    List<String> findGradeListByProductId(@Param("productId") Integer productId);

    List<String> findGradeListByProductIdStr(@Param("list") List productId);

    List<MallPrice> findPriceAndGradeList(@Param("productId") Integer productId, @Param("grade") String grade);

    List<MallPrice> findPriceListByProductIdAndGrade(@Param("productId") Integer productId, @Param("grade") String grade);

    void deleteByProductId(Integer product_id);


    MallPrice selectOneByProductId(@Param("id") Integer id);

    String findOne0Grade(@Param("id") Integer id);

    String selectGradeByPriceId(@Param("priceId") int priceId);

    String selectMaxGradeByProductId(@Param("productId") Integer productId);

    List<String> selectGradeList(@Param("productId") Integer id);

    List<Integer> findPriceIdListByProductIdList(@Param("productIdList") List<Integer> productIdList);

    List<MallPrice> selectByPriceIdList(@Param("priceIdList") List<Integer> subPriceIdList);

    List<MallPrice> selectByProductId(@Param("productId") Integer productId);

    List<MallPrice> checkGradeByProductId(@Param("productId") Integer id);

    List<MallPrice> selectByCountWithLimit(@Param("userId") Integer userId, @Param("start") Integer start, @Param("end") Integer end);
}